﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Com.CMS263.PO;
using Com.CMS263.Util;
using Com.CMS263.BLL;
using System.Collections.Generic;

namespace Com.CMS263.Web.manage.SubBaseArt
{
    public partial class BaseArtList : System.Web.UI.Page
    {
        public IList<ArtBase> artList = null;

        ExtAttributeBLL eaBLL = new ExtAttributeBLL();

        ExtValueBLL evBLL = new ExtValueBLL();

        ArtBaseBLL abBLL = new ArtBaseBLL();
        AttributeTypeBLL atbll = new AttributeTypeBLL();
        public IList<ExtAttribute> eaList = null;

        int pageSize = 24;

        public int page = 1;

        string key = "";

        int typeId;
        //菜单编号
        int artId;
        protected void Page_Load(object sender, EventArgs e)
        {
            typeId = int.Parse(Request["pid"]);


            key = StringUtil.checkStr(Request["txtKey"]);

            artId = int.Parse(Request["artid"]);

            this.lbTypeName.Text = atbll.GetAttributeById(typeId).typeName;
            //通过程序类别得到所有可以在后台展示的扩展属性
            eaList = eaBLL.GetShowInBackAttrByTypeId(typeId);

            if (!string.IsNullOrEmpty(Request["page"]))
            {
                page = int.Parse(Request["page"]);
            }
            if (!string.IsNullOrEmpty(key))
            {
                this.txtKey.Text = key;
            }
            artList = abBLL.GetResultByKA(artId, page, pageSize, key, typeId);

        }
        public string GetExtValueByBaseArtId(int artId, int attrId)
        {
            return evBLL.GetValueById(artId, attrId);
        }
        public string GetPager()
        {
            int total = abBLL.GetCountByArtId(artId, key, typeId);
            return Pager.GetPager(total, pageSize, page, "&pid=" + typeId + "&txtKey=" + key + "&artid=" + artId.ToString());
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

        }

    }
}
